﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;


namespace Tunnel
{
    // 注意: 使用“重构”菜单上的“重命名”命令，可以同时更改代码和配置文件中的类名“DataConnectionService”。
    [ServiceBehavior(InstanceContextMode=InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple)]
    public class DataConnectionService : IDataConnectionService
    {
        public void DoWork()
        {
        }
        MainForm mainForm;
        /// <summary>
        /// 构造方法
        /// </summary>
        /// <param name="mainForm">传入主窗体实体对象</param>
        public DataConnectionService(MainForm mainForm)
        {
            this.mainForm = mainForm;
        }
        /// <summary>
        /// 修改设备状态
        /// </summary>
        /// <param name="deviceID">设备ID</param>
        /// <param name="statusID">设备状态ID</param>
        /// <param name="deviceType">设备类型</param>
        /// <param name="updateTime">更新时间</param>
        /// <returns>是否修改成功</returns>
        public bool ChangeDeviceStatus(string deviceID, string statusID,string statusDescription, string deviceType, string updateTime)
        {
            bool success = mainForm.refreshDeviceStatus(deviceID, statusID, statusDescription, deviceType, updateTime);
            if(success)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        public bool ChangeDeviceNum(string deviceID,string numType, int num1, int num2, int num3)
        {
            bool success = mainForm.refreshDeviceNum(deviceID, numType, num1,num2,num3);
            if (success)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}
